<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增海关统计')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-customs-add">
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">客户统计号：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="customsStatNo" id="customsStatNo" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">客户计量单位：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="customsUnitMeas" id="nOTUSED" required>
					<a class="btn btn-primary btn-rounded btn-sm" onclick="showOpen('NOTUSED')"><i class="fa fa-search"></i>&nbsp;请选择</a>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">描述：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="description" id="description" required>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "customs";
		function showOpen(value) {
			var prefixTable = ctx + "demo/modal";
			$.modal.open("选择用户", prefixTable + "/radionForisounit?unitType="+value);
		}

		$("#form-transport-add").validate({
			onkeyup: false,
			rules:{
				customsStatNo:{
					remote: {
		                url: ctx + "customs/checkPostNameUnique",
		                type: "post",
		                dataType: "json",
		                data: {
		                	"customsStatNo" : function() {
		                        return $.common.trim($("#customsStatNo").val());
		                    }
		                },
		                dataFilter: function(data, type) {
		                	return $.validate.unique(data);
		                }
		            }
				}
				// weightCapacity:{
				// 	digits:true
				// },
				// volumeCapacity:{
				// 	digits:true
				// },
			},
			messages: {
		        "customsStatNo": {
		            remote: "客户统计号已经存在"
		        }
		    },
		    focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-customs-add').serialize());
	        }
	    }
	</script>
</body>
</html>
